/**
 * @FileName: FeedbackController.java
 * @Author
 * @Description:
 * @Date 2016年10月5日 下午11:29:12
 * @CopyRight ZTE Corporation
 */
package cn.hpclub.server.controller.h5;

import cn.hpclub.server.util.HttpUtil;
import cn.hpclub.server.util.SystemConfigUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class SysUtilController extends BaseH5Controller{
    private static Logger log = LoggerFactory.getLogger(SysUtilController.class);
    private String ESB_HOST_PREFIX =  SystemConfigUtil.getSystemConfig().getEsbHostPrefix();


    /**
     * @describe 此接口为能力开放平台迁移到esb新的获取验证码接口
     * @return
     */
    public void sendOrCheckSmsCode(){
        String phoneNumber = getPara("phoneNumber", "");
        String empCode = getPara("empCode", "");
        int passmode = getParaToInt("passmode",0);
        String smsCode = getPara("smsCode", "");
        String token = getPara("token", "");

        String url =  ESB_HOST_PREFIX+"sQryRandPass?token="+token;
        String data = "{" +
                "    \"BODY\": {" +
                "\"OLD_SERVER\": \"sRandSmsPwd\"," +
                "\"SERVICE_NO\": \""+phoneNumber+"\"," +
                "\"PROVINCE_GROUP\": \"10008\"," +
                "\"LOGIN_NO\": \""+empCode+"\"," +
                "\"PHONE_NO\": \""+phoneNumber+"\"," +
                "\"PASS_MODE\": \""+passmode+"\"," +
                "\"SMS_PWD\": \""+smsCode+"\"," +
                "\"PASS_LENGTH\": \"6\"}" +
                "}";
        String resultStr = HttpUtil.getHttpByPostBody(url, data);
        renderJson(resultStr);
    }
}
